
const moment = require('moment');
const start_time = '2022-04-24 12:00:00';
const end_time = '2022-06-24 12:00:00';
const start = moment(start_time).unix();
const end = moment(end_time).unix();
console.log('start:' + start);
console.log('end:' + end);

function getTabelNames(start_time, end_time, prefix) {
  console.log('start_time:' + start_time);
  console.log('end_time:' + end_time);
  prefix = prefix || '';
  var s = moment.unix(start_time);
  console.log('s:' + s);
  var e = moment.unix(end_time);
  console.log('e:' + e);
  let tables = [];
  for (; (s.year() < e.year() || (s.year() === e.year() && s.month() <= e.month())); s.add(1, 'month')) {
    if (s.year() <= 2014) {
      // 2015 年开始支持新的计费表
      continue;
    }
    tables.push(prefix + 'stats-' + s.format('YYYY-MM'));
  }
  return tables;
}

function main (start, end) {
  const table_name = getTabelNames(start, end, 'compression_flow_');
  console.log('table_name:' + table_name);
}

main(start, end);